home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / GFXFX2.ZIP / SCR_SMTH.PAS < prev    next >
Pascal/Delphi Source File  |  1995-02-14  |  2KB  |  127 lines

  1.  
  2. program smoothtextscroll; { SCR_SMTH.PAS }
  3. { HSTS, by Bas van Gaalen.
  4.   Tested on 386dx/40, 486dx2/66, 486-laptop, 486dx, all fine... }
  5. uses u_vga,u_mdx,u_txt,u_kb;
  6. const
  7.   vidseg:word=$b800; lines=16;
  8.   txt:string=' Hardware-Smooth-Text-Scroll. Made by Bas van Gaalen '+
  9.     'and Sven van Heel...    ';
  10. var fofs,fseg:word;
  11.  
  12. procedure setup(ad:word); assembler;
  13. asm
  14.   push bp
  15.   mov ax,1130h
  16.   mov bh,6
  17.   int 10h
  18.   mov fseg,es
  19.   mov fofs,bp
  20.   pop bp
  21.  
  22.   mov dx,3d4h
  23.   mov al,18h
  24.   mov ah,[byte(ad)]
  25.   out dx,ax
  26.   mov al,7
  27.   out dx,al
  28.   inc dx
  29.   in al,dx
  30.   dec dx
  31.   mov ah,[byte(ad)+1]
  32.   and ah,00000001b
  33.   shl ah,4
  34.   and al,11101111b
  35.   or al,ah
  36.   mov ah,al
  37.   mov al,7
  38.   out dx,ax
  39.  
  40.   mov al,9
  41.   out dx,al
  42.   inc dx
  43.   in al,dx
  44.   dec dx
  45.   mov ah,[byte(ad)+1]
  46.   and ah,00000010b
  47.   shl ah,5
  48.   and al,10111111b
  49.   or al,ah
  50.   mov ah,al
  51.   mov al,9
  52.   out dx,ax
  53.  
  54.   mov dx,03c0h
  55.   mov al,10h+32
  56.   out dx,al
  57.   inc dx
  58.   in al,dx
  59.   and al,11011111b
  60.   or al,00100000b
  61.   dec dx
  62.   out dx,al
  63.  
  64.   mov dx,03d4h
  65.   mov al,11h
  66.   out dx,al
  67.   inc dx
  68.   in al,dx
  69.   and al,7fh
  70.   mov ah,al
  71.   mov al,11h
  72.   dec dx
  73.   out dx,ax
  74.   mov ax,4e01h
  75.   out dx,ax
  76.   mov ax,0105h
  77.   out dx,ax
  78.   mov al,11h
  79.   out dx,al
  80.   inc dx
  81.   in al,dx
  82.   or al,80h
  83.   mov ah,al
  84.   mov al,11h
  85.   dec dx
  86.   out dx,ax
  87. end;
  88.  
  89. procedure setsmooth(smt:byte); assembler;
  90. asm
  91.   mov dx,03c0h
  92.   mov al,13h+32
  93.   out dx,al
  94.   inc dx
  95.   in al,dx
  96.   and al,11110000b
  97.   mov ah,smt
  98.   or al,ah
  99.   dec dx
  100.   out dx,al
  101. end;
  102.  
  103. var x,y,i,ch:word; cx,tidx:byte;
  104. begin
  105.   setvideo(3);
  106.   setup(lines*16);
  107.   mdx_setaddress((25-lines)*80);
  108.   dspat('Hey, a REAL smooth textscroll!',3,0,7); { note the pos! }
  109.   x:=0; cx:=0; tidx:=1; i:=8;
  110.   repeat
  111.     vretrace;
  112.     setsmooth(x);
  113.     x:=(3+x) mod 9;
  114.     if x=6 then begin
  115.       ch:=byte(txt[tidx]) shl 4;
  116.       for y:=0 to lines-1 do begin
  117.         move(mem[vidseg:(25-lines+y)*160+4],mem[vidseg:(25-lines+y)*160+2],158);
  118.         if boolean((mem[fseg:fofs+ch+y] shr i) and 1) then
  119.           memw[vidseg:(25-lines+y)*160+158]:=$1fdb else
  120.           memw[vidseg:(25-lines+y)*160+158]:=$1020;
  121.       end;
  122.       i:=(i-1) mod 8; if not boolean(i) then tidx:=1+tidx mod length(txt);
  123.     end;
  124.   until keypressed;
  125.   setvideo(u_lm);
  126. end.
  127.